package com.example.demo.util;

import org.apache.commons.lang3.time.DateFormatUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.concurrent.TimeUnit;

/**
 * Created by Administrator on 2017-6-26.
 */
public class expectUtil {

    public static void main(String[] args) {


        try {
/**
 *
 ROWID
 */

/**
 * (0)
 101
 2017-6-26
 2018-6-1
 10

 2018-6-1
 2017-6-27
 2017-6-30
 2017-6-27
 2017-6-27
 2017-6-27
 2017-6-27
 <ExpectAwardInfoList><ExpectAwardInfo id="1" name="选前1直选" isfloat="0" bonus="13.0"/><ExpectAwardInfo id="2" name="选前2直选" isfloat="0" bonus="130.0"/><ExpectAwardInfo id="3" name="选前3直选" isfloat="0" bonus="1170.0"/><ExpectAwardInfo id="4" name="选前2组选" isfloat="0" bonus="65.0"/><ExpectAwardInfo id="5" name="选前3组选" isfloat="0" bonus="195.0"/><ExpectAwardInfo id="6" name="任选2中2" isfloat="0" bonus="6.0"/><ExpectAwardInfo id="7" name="任选3中3" isfloat="0" bonus="19.0"/><ExpectAwardInfo id="8" name="任选4中4" isfloat="0" bonus="78.0"/><ExpectAwardInfo id="9" name="任选5中5" isfloat="0" bonus="540.0"/><ExpectAwardInfo id="10" name="任选6中5" isfloat="0" bonus="90.0"/><ExpectAwardInfo id="11" name="任选7中5" isfloat="0" bonus="26.0"/><ExpectAwardInfo id="12" name="任选8中5" isfloat="0" bonus="9.0"/></ExpectAwardInfoList>
 1970-1-1
 2018-10-1 下午 12:07:30
 1970-1-1
 2017-6-27
 1970-1-1
 1970-1-1
 0

 900
 AAAe73AAPAADFMsAAA
 */

            String expect = "170627067";
            String s = MessageFormat.format("insert into t_expect( E_EXPECT,\n" +
                            " E_LOTID,\n" +
                            " E_STARTTIME,\n" +
                            " E_ENDTIME,\n" +
                            " E_STATUS,\n" +
                            " E_OPENCODE,\n" +
                            " E_BUYENDTIME,\n" +
                            " E_APISTARTTIME,\n" +
                            " E_APIENDTIME,\n" +
                            " E_PRINTENDTIME,\n" +
                            " E_OPENCODETIME,\n" +
                            " E_ADDTIME,\n" +
                            " E_MODIFYTIME,\n" +
                            " E_DECRIPTION,\n" +
                            " E_UPLOADTIME,\n" +
                            " E_NORMALFQENDTIME,\n" +
                            " E_FILEFQENDTIME,\n" +
                            " E_GETOPENCODETIME,\n" +
                            " E_ADUITOPENCODETIME,\n" +
                            " E_PRIZETIME,\n" +
                            " E_PROC_STATUS,\n" +
                            " E_PASS,\n" +
                            " E_NOTIFY_STATUS ) values ({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22})",
                    expect ,101
                    ,DateFormatUtils.format(Instant.now().toEpochMilli() , "yyyy-MM-dd")
                    ,DateFormatUtils.format(Instant.now().toEpochMilli() + TimeUnit.MINUTES.toMillis(5), "yyyy-MM-dd HH:mm")
                    ,10
                    ,""
                    ,DateFormatUtils.format(Instant.now().toEpochMilli() + TimeUnit.MINUTES.toMillis(5), "yyyy-MM-dd HH:mm")
                    ,DateFormatUtils.format(Instant.now().toEpochMilli() , "yyyy-MM-dd")
                    ,DateFormatUtils.format(Instant.now().toEpochMilli() , "yyyy-MM-dd")
                    ,DateFormatUtils.format(Instant.now().toEpochMilli() + TimeUnit.MINUTES.toMillis(5), "yyyy-MM-dd HH:mm")
                    ,DateFormatUtils.format(Instant.now().toEpochMilli() + TimeUnit.MINUTES.toMillis(5), "yyyy-MM-dd HH:mm")
                    ,DateFormatUtils.format(Instant.now().toEpochMilli() + TimeUnit.MINUTES.toMillis(1), "yyyy-MM-dd HH:mm")


            );

             String b  =" E_LOTID,\n" +
                     " E_STARTTIME,\n" +
                     " E_ENDTIME,\n" +
                     " E_STATUS,\n" +
                     " E_OPENCODE,\n" +
                     " E_BUYENDTIME,\n" +
                     " E_APISTARTTIME,\n" +
                     " E_APIENDTIME,\n" +
                     " E_PRINTENDTIME,\n" +
                     " E_OPENCODETIME,\n" +
                     " E_ADDTIME,\n" +
                     " E_MODIFYTIME,\n" +
                     " E_DECRIPTION,\n" +
                     " E_UPLOADTIME,\n" +
                     " E_NORMALFQENDTIME,\n" +
                     " E_FILEFQENDTIME,\n" +
                     " E_GETOPENCODETIME,\n" +
                     " E_ADUITOPENCODETIME,\n" +
                     " E_PRIZETIME,\n" +
                     " E_PROC_STATUS,\n" +
                     " E_PASS,\n" +
                     " E_NOTIFY_STATUS";

           String []arr=  b.replaceAll("," ,"").split("\n");
            for (String s1 : arr) {
                System.out.println("#{now},");
            }
            String ss = "";
            for (int i = 0; i < 23; ++i) {
                ss += "{" + i + "},";
            }

            ;
            System.out.println(ss);
            System.out.println(s);
        } catch (Exception e) {

        }
    }


}
